const ExtensionUtils = imports.misc.extensionUtils;
const { loadInterfaceXML } = imports.misc.fileUtils;
-const { ExtensionState } = ExtensionUtils;
+const { ExtensionState, ExtensionType } = ExtensionUtils;
const GnomeShellIface = loadInterfaceXML('org.gnome.Shell.Extensions');
const GnomeShellProxy = Gio.DBusProxy.makeProxyWrapper(GnomeShellIface);
return this.application.shellProxy;
}
+ uninstall(uuid) {
+ let row = this._findExtensionRow(uuid);
+
+ let dialog = new Gtk.MessageDialog({
+ transient_for: this,
+ modal: true,
+ text: _('Remove “%s”?').format(row.name),
+ secondary_text: _('If you remove the extension, you need to return to download it if you want to enable it again'),
+ });
+
+ dialog.add_button(_('Cancel'), Gtk.ResponseType.CANCEL);
+ dialog.add_button(_('Remove'), Gtk.ResponseType.ACCEPT)
+ .get_style_context().add_class('destructive-action');
+
+ dialog.connect('response', (dlg, response) => {
+ if (response === Gtk.ResponseType.ACCEPT)
+ this._shellProxy.UninstallExtensionRemote(uuid);
+ dialog.destroy();
+ });
+ dialog.present();
+ }
+
openPrefs(uuid) {
if (!this._loaded)
this._startupUuid = uuid;
});
this._actionGroup.add_action(action);
+ action = new Gio.SimpleAction({
+ name: 'uninstall',
+ enabled: this.type === ExtensionType.PER_USER,
+ });
+ action.connect('activate', () => this.get_toplevel().uninstall(this.uuid));
+ this._actionGroup.add_action(action);
+
action = new Gio.SimpleAction({
name: 'enabled',
state: new GLib.Variant('b', false),
return this._extension.hasPrefs;
}
+ get type() {
+ return this._extension.type;
+ }
+
get creator() {
return this._extension.metadata.creator || '';
}
<property name="top_attach">3</property>
</packing>
</child>
+ <child>
+ <object class="GtkButton" id="removeButton">
+ <property name="visible"
+ bind-source="removeButton"
+ bind-property="sensitive"
+ bind-flags="sync-create"/>
+ <property name="no_show_all">True</property>
+ <property name="label" translatable="yes">Remove…</property>
+ <property name="action_name">row.uninstall</property>
+ <property name="hexpand">True</property>
+ <property name="halign">end</property>
+ <property name="valign">end</property>
+ <style>
+ <class name="destructive-action"/>
+ </style>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">3</property>
+ </packing>
+ </child>
</object>
</child>
</object>